package com.example.zx.theline.zsjh.pub;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.example.zx.theline.R;

import GsonBean.ShyjhxqBean;
import GsonBean.ZsyjhxxBean;
import Utils.MyToast;
import app.MyApplication;
import base.BaseActivity;

/**
 * Created by Ren on 2017/8/14.
 */

public class ZsyjhChaKanActivity extends BaseActivity implements View.OnClickListener {


    public static ShyjhxqBean ZsyjhxxBean;

    /**
     * 标题
     */
    TextView centerTextView;
    /**
     * 计划内容
     */
    TextView lb;
    TextView yf;
    TextView ydbh;
    TextView rqsj;
    TextView kssj;
    TextView jssj;
    TextView xm;
    TextView dd;
    TextView hb;
    TextView lc;
    TextView xmmc;
    TextView sgnr;
    TextView sgjx;
    TextView blfh;

    /**
     * 相关单位
     */
    TextView sgdw;
    TextView sgdwfzr;
    TextView jldw;
    TextView jldwfzr;
    TextView jsdw;
    TextView cwzd;
    TextView sbgldw;
    TextView qtdw;
    TextView shcs;
    TextView xmzgbm;

    /**
     * 按钮
     */
    TextView cancel;
    TextView leftTextView;
    private LinearLayout blfh_layout;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_zsyjhchakan);
        InitView();
        InitData();
        InitListen();
    }

    @Override
    protected void InitView() {

        centerTextView = (TextView) findViewById(R.id.centerTextView);
        centerTextView.setText("月计划详情");

        lb = (TextView) findViewById(R.id.lb);
        yf = (TextView) findViewById(R.id.yf);
        ydbh = (TextView) findViewById(R.id.ydbh);
        rqsj = (TextView) findViewById(R.id.rqsj);
        kssj = (TextView) findViewById(R.id.kssj);
        jssj = (TextView) findViewById(R.id.jssj);
        xm = (TextView) findViewById(R.id.xm);
        dd = (TextView) findViewById(R.id.dd);
        hb = (TextView) findViewById(R.id.hb);
        lc = (TextView) findViewById(R.id.lc);
        xmmc = (TextView) findViewById(R.id.xmmc);
        sgnr = (TextView) findViewById(R.id.sgnr);
        sgjx = (TextView) findViewById(R.id.sgjx);
        blfh = (TextView) findViewById(R.id.blfh);
        blfh_layout = (LinearLayout) findViewById(R.id.blfh_layout);

        sgdw = (TextView) findViewById(R.id.sgdw);
        sgdwfzr = (TextView) findViewById(R.id.sgdwfzr);
        jldw = (TextView) findViewById(R.id.jldw);
        jldwfzr = (TextView) findViewById(R.id.jldwfzr);
        jsdw = (TextView) findViewById(R.id.jsdw);
        cwzd = (TextView) findViewById(R.id.cwzd);
        sbgldw = (TextView) findViewById(R.id.sbgldw);
        qtdw = (TextView) findViewById(R.id.qtdw);
        shcs = (TextView) findViewById(R.id.shcs);
        xmzgbm = (TextView) findViewById(R.id.xmzgbm);

        cancel = (TextView) findViewById(R.id.cancel);
        leftTextView = (TextView) findViewById(R.id.leftTextView);

    }

    @Override
    protected void InitData() {
        if (ZsyjhxxBean == null) {
            MyApplication.ShowWaitDialog(this);
            MyApplication.setWaitDialogMsg("数据错误");
        } else {
            lb.setText(ZsyjhxxBean.getInfo().getLb());
            yf.setText(ZsyjhxxBean.getInfo().getSgny());
            ydbh.setText(ZsyjhxxBean.getInfo().getBh());

            kssj.setText(ZsyjhxxBean.getInfo().getSgrqList().get(0).getSgrqks());
            jssj.setText(ZsyjhxxBean.getInfo().getSgrqList().get(0).getSgrqjs());
            xm.setText(ZsyjhxxBean.getInfo().getXlxbList().get(0).getXlmc());
            dd.setText(ZsyjhxxBean.getInfo().getXlxbList().get(0).getSgdd());
            hb.setText(ZsyjhxxBean.getInfo().getXlxbList().get(0).getXbmc());
            lc.setText(ZsyjhxxBean.getInfo().getXlxbList().get(0).getLic());
            xmmc.setText(ZsyjhxxBean.getInfo().getXmmc());
            sgnr.setText(ZsyjhxxBean.getInfo().getNrmc());
            sgjx.setText(ZsyjhxxBean.getInfo().getJxmc());
//            blfh.setText(ZsyjhxxBean.getInfo().getFhcsmc());
            if (ZsyjhxxBean.getInfo().getLb().equals("C")) {
                blfh_layout.setVisibility(View.GONE);
            } else {
                blfh_layout.setVisibility(View.VISIBLE);
                blfh.setText(ZsyjhxxBean.getInfo().getFhcsmc());
            }

            sgdw.setText(ZsyjhxxBean.getInfo().getSgdwmc());
            sgdwfzr.setText(ZsyjhxxBean.getInfo().getSgdwfzr());
            jldw.setText(ZsyjhxxBean.getInfo().getJldw());
            jldwfzr.setText(ZsyjhxxBean.getInfo().getJldwfzr());
            jsdw.setText(ZsyjhxxBean.getInfo().getJsdwmc());
            cwzd.setText(ZsyjhxxBean.getInfo().getCwzd());
            sbgldw.setText(ZsyjhxxBean.getInfo().getSbgldw());
            qtdw.setText(ZsyjhxxBean.getInfo().getQtdw());
            shcs.setText(ZsyjhxxBean.getInfo().getShcsmc());
            xmzgbm.setText(ZsyjhxxBean.getInfo().getXmzgbm());
        }

    }

    @Override
    protected void InitListen() {
        cancel.setOnClickListener(this);
        leftTextView.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.cancel:
                finish();
                break;
            case R.id.leftTextView:
                finish();
                break;

        }
    }
}
